from . import Base, session
from sqlalchemy import Column, VARCHAR, Integer, Text, ForeignKey


class Entity(Base):
    __tablename__ = 'entity'

    id = Column(VARCHAR(10), primary_key=True)
    type = Column(VARCHAR(20))


class Label(Base):
    __tablename__ = 'label'
    id = Column(Integer, primary_key=True)
    eid = Column(VARCHAR(10), ForeignKey("entity.id"))
    language = Column(VARCHAR(10))
    value = Column(VARCHAR(255))


class Description(Base):
    __tablename__ = 'description'
    id = Column(Integer, primary_key=True)
    eid = Column(VARCHAR(10), ForeignKey("entity.id"))
    language = Column(VARCHAR(10))
    value = Column(Text)


class Alias(Base):
    __tablename__ = 'alias'
    id = Column(Integer, primary_key=True)
    eid = Column(VARCHAR(10), ForeignKey("entity.id"))
    language = Column(VARCHAR(10))
    value = Column(VARCHAR(255))


class SiteLink(Base):
    __tablename__ = 'sitelink'
    id = Column(Integer, primary_key=True)
    eid = Column(VARCHAR(10), ForeignKey("entity.id"))
    site = Column(VARCHAR(255))
    title = Column(VARCHAR(255))
    badges = Column(Text)
